/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entities;

import java.io.Serializable;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Juan
 */
@Entity
@Table(name = "quote")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Quote.findAll", query = "SELECT q FROM Quote q"),
    @NamedQuery(name = "Quote.findById", query = "SELECT q FROM Quote q WHERE q.id = :id"),
    @NamedQuery(name = "Quote.findByLow", query = "SELECT q FROM Quote q WHERE q.low = :low"),
    @NamedQuery(name = "Quote.findByHigh", query = "SELECT q FROM Quote q WHERE q.high = :high"),
    @NamedQuery(name = "Quote.findByOpen", query = "SELECT q FROM Quote q WHERE q.open = :open"),
    @NamedQuery(name = "Quote.findByClose", query = "SELECT q FROM Quote q WHERE q.close = :close"),
    @NamedQuery(name = "Quote.findByVolume", query = "SELECT q FROM Quote q WHERE q.volume = :volume")})
public class Quote implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Long id;
    @Basic(optional = false)
    @Column(name = "low")
    private double low;
    @Basic(optional = false)
    @Column(name = "high")
    private double high;
    @Basic(optional = false)
    @Column(name = "open")
    private double open;
    @Basic(optional = false)
    @Column(name = "close")
    private double close;
    @Basic(optional = false)
    @Column(name = "volume")
    private double volume;
    @JoinColumn(name = "iddate", referencedColumnName = "id")
    @ManyToOne
    private Fecha iddate;
    @JoinColumn(name = "idstock", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Stock idstock;

    public Quote() {
    }

    public Quote(Long id) {
        this.id = id;
    }

    public Quote(Long id, double low, double high, double open, double close, double volume) {
        this.id = id;
        this.low = low;
        this.high = high;
        this.open = open;
        this.close = close;
        this.volume = volume;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public double getLow() {
        return low;
    }

    public void setLow(double low) {
        this.low = low;
    }

    public double getHigh() {
        return high;
    }

    public void setHigh(double high) {
        this.high = high;
    }

    public double getOpen() {
        return open;
    }

    public void setOpen(double open) {
        this.open = open;
    }

    public double getClose() {
        return close;
    }

    public void setClose(double close) {
        this.close = close;
    }

    public double getVolume() {
        return volume;
    }

    public void setVolume(double volume) {
        this.volume = volume;
    }

    public Fecha getIddate() {
        return iddate;
    }

    public void setIddate(Fecha iddate) {
        this.iddate = iddate;
    }

    public Stock getIdstock() {
        return idstock;
    }

    public void setIdstock(Stock idstock) {
        this.idstock = idstock;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Quote)) {
            return false;
        }
        Quote other = (Quote) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "dataacces.Quote[ id=" + id + " ]";
    }
    
}
